//
//  BHWonderfulGameCell.swift
//  BigHealth
//
//  Created by 蔺百好 on 2021/6/9.
//

import UIKit

class BHWonderfulGameCell: UICollectionViewCell {

    @IBOutlet weak var baoming_label: UILabel!
    @IBOutlet weak var iconImageView: UIImageView!
    @IBOutlet weak var name_label: UILabel!
    @IBOutlet weak var time_label: UILabel!
    @IBOutlet weak var area_label: UILabel!
    @IBOutlet weak var holder_name_label: UILabel!
    @IBOutlet weak var cost_label: UILabel!
    
    @IBOutlet weak var cost_type_label: UILabel!
    
    var model: BHCommonGameModel! {
        didSet {
            self.iconImageView.sd_setImage(with: URL.init(string: model.coverUrl), completed: nil)
            self.name_label.text = model.name
            self.time_label.text = model.startTime
            self.area_label.text = "\(model.cityName)/\(model.regionName)"
            self.holder_name_label.text = model.sponsor
            
            self.baoming_label.text = "报名\(model.number)人"
            if model.feeType == 2 { // 押金
                self.cost_type_label.text = "押金："
                self.cost_label.text = "¥\(model.fee)"

            }else if model.feeType == 1 { // 报名费
                self.cost_type_label.text = "报名费："
                self.cost_label.text = "¥\(model.fee)"
            }else { // 免费
                self.cost_type_label.text = "报名费："
                self.cost_label.text = "无需费用"
            }
        }
    }
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        self.baoming_label.addLayerCorner(2, 0.5, .color_34CE98)
        self.iconImageView.addLayerCorner(4, 0, .white)
    }

    
    static var gameHeight: CGFloat {
        get {
            return 154
        }
    }
}
